Oozie Bundle Specification

定义: Kick-off-time:启动和提交coordinator 应用的时间

name: The name for the bundle job.
controls: The control specification for the bundle.
    kick-off-time: It defines when the bundle job should start and submit the coordinator applications. This field is optional and the default is NOW that means the job should start right-a-way.
coordinator: Coordinator application specification. There should be at least one coordinator application in any bundle.
    name: Name of the coordinator application. It can be used for referring this application through bundle to control such as kill, suspend, rerun.
    app-path: Path of the coordinator application definition in hdfs. This is a mandatory element.
    configuration: A hadoop like configuration to parameterize corresponding coordinator application. This is optional.

语法:

<bundle-app name=[NAME]  xmlns='uri:oozie:bundle:0.1'> 
    <controls>
        <kick-off-time>[DATETIME]</kick-off-time>
    </controls>
    <coordinator name=[NAME] >
        <app-path>[COORD-APPLICATION-PATH]</app-path>
        <configuration>
            <property>
              <name>[PROPERTY-NAME]</name>
              <value>[PROPERTY-VALUE]</value>
            </property>
            ...
         </configuration>
    </coordinator>
    ...
</bundle-app>

样例:包含两个coordinator 作业

<bundle-app name='APPNAME' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='uri:oozie:bundle:0.1'> 
    <controls>
        <kick-off-time>${kickOffTime}</kick-off-time>
    </controls>
    <coordinator name='coordJobFromBundle1' >
        <app-path>${appPath}</app-path>
        <configuration>
            <property>
                <name>startTime1</name>
                <value>${START_TIME}</value>
            </property>
            <property>
                <name>endTime1</name>
                <value>${END_TIME}</value>
            </property>
        </configuration>
    </coordinator>
    <coordinator name='coordJobFromBundle2' >
        <app-path>${appPath2}</app-path>
        <configuration>
            <property>
                <name>startTime2</name>
                <value>${START_TIME2}</value>
            </property>
            <property>
                <name>endTime2</name>
                <value>${END_TIME2}</value>
            </property>
        </configuration>
    </coordinator>
</bundle-app>

Bundle 作业提交

Bundle 应用定义HDFS路径必须指定'oozie.bundle.application.path'作业属性.

所有Bundle作业属性,HDFS路径,'user.name'和'oozie.job.acl'必须提交给Oozie使用xml配置文件(Hadoop XML configuration file).

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <property>
        <name>user.name</name>
        <value>joe</value>
    </property>
    <property>
        <name>oozie.bundle.application.path</name>
        <value>hdfs://foo:8020/user/joe/mybundles/hello-bundle1.xml</value>
    </property>
    ...
</configuration>

Oozie Bundle Schema 0.2

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:bundle="uri:oozie:bundle:0.2"
           elementFormDefault="qualified" targetNamespace="uri:oozie:bundle:0.2">    
    <xs:element name="bundle-app" type="bundle:BUNDLE-APP"/>
    <-- 
        <bundle-app name="bundle-app">
            <parameters>...</parameters>
            <controls>...</controls>
            <coordinator>...</coordinator>
        <parameters>
    -->
    <xs:simpleType name="IDENTIFIER">
        <xs:restriction base="xs:string">
            <xs:pattern value="([a-zA-Z]([\-_a-zA-Z0-9])*){1,39}"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="BUNDLE-APP">
        <xs:sequence>
            <xs:element name="parameters" type="bundle:PARAMETERS" minOccurs="0" maxOccurs="1"/>
            <xs:element name="controls" type="bundle:CONTROLS" minOccurs="0" maxOccurs="1"/>
            <xs:element name="coordinator" type="bundle:COORDINATOR" minOccurs="1" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>
    <xs:complexType name="PARAMETERS">
        <xs:sequence>
            <xs:element name="property" minOccurs="1" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="name" minOccurs="1" maxOccurs="1" type="xs:string"/>
                        <xs:element name="value" minOccurs="0" maxOccurs="1" type="xs:string"/>
                        <xs:element name="description" minOccurs="0" maxOccurs="1" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <-- 
        <parameters>
            <property>
               <name>prop1</name>
               <value>prop1</value>
               <description>prop1</description>
            </property>
        <parameters>
    -->
    <xs:complexType name="CONTROLS">
        <xs:sequence minOccurs="0" maxOccurs="1">
            <xs:element name="kick-off-time" type="xs:string" minOccurs="0" maxOccurs="1"/>
        </xs:sequence>
    </xs:complexType>
    <-- 
        <controls>
           <kick-off-time>${kickOffTime}</kick-off-time>
        </controls>
    -->
    <xs:complexType name="COORDINATOR">
        <xs:sequence  minOccurs="1" maxOccurs="1">
            <xs:element name="app-path" type="xs:string" minOccurs="1" maxOccurs="1"/>
            <xs:element name="configuration" type="bundle:CONFIGURATION" minOccurs="0" maxOccurs="1"/>
        </xs:sequence>
        <xs:attribute name="name" type="bundle:IDENTIFIER" use="required"/>
        <xs:attribute name="critical" type="xs:string" use="optional"/>
    </xs:complexType>
    <-- 
    <coordinator name="coordApp" critical="" >
        <app-path>startTime2</app-path>
        <configuration>....</configuration>
    </coordinator>
    -->
    <xs:complexType name="CONFIGURATION">
        <xs:sequence>
            <xs:element name="property" minOccurs="1" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="name" minOccurs="1" maxOccurs="1" type="xs:string"/>
                        <xs:element name="value" minOccurs="1" maxOccurs="1" type="xs:string"/>
                        <xs:element name="description" minOccurs="0" maxOccurs="1" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <-- 
    <configuration>
        <property>
            <name>startTime2</name>
            <value>${START_TIME2}</value>
        </property>
    </configuration>
    -->
</xs:schema>